<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
	<title>固件程序管理管理</title>
	<meta name="decorator" content="default"/>
	<script type="text/javascript">
		$(document).ready(function() {
			//$("#name").focus();
            if($("#type").val()!='mcu'){
                $("#pg1").css("display",'');
                $("#pg2").css("display",'none');
            }else{
                $("#pg2").css("display",'');
                $("#pg1").css("display",'none');
            }
            $("#type").change(function(){
              var data= $(this).val()
              if(data!='mcu'){
				  $("#pg1").css("display",'');
                  $("#pg2").css("display",'none');
			  }else{
                  $("#pg2").css("display",'');
                  $("#pg1").css("display",'none');
			  }
            });
			$("#inputForm").validate({
				submitHandler: function(form){
					loading('正在提交，请稍等...');
                    timeVali($("#btnSubmit"));
					form.submit();
				},
				errorContainer: "#messageBox",
				errorPlacement: function(error, element) {
					$("#messageBox").text("输入有误，请先更正。");
					if (element.is(":checkbox")||element.is(":radio")||element.parent().is(".input-append")){
						error.appendTo(element.parent().parent());
					} else {
						error.insertAfter(element);
					}
				}
			});
		});
	</script>
</head>
<body>
	<ul class="nav nav-tabs">
		<li><a href="${ctx}/source/program/eleSourceProgram/"><spring:message code="menu.firmware.list"/></a></li>
		<li class="active">
			<a href="${ctx}/source/program/eleSourceProgram/form?id=${eleSourceProgram.id}">
				<shiro:hasPermission name="source:program:eleSourceProgram:edit">
				<c:if test="${not empty eleSourceProgram.id}">
				<spring:message code="firmware.modify"/>
			</c:if>
			<c:if test="${empty eleSourceProgram.id}">
				<spring:message code="firmware.add"/>
			</c:if>
				</shiro:hasPermission><shiro:lacksPermission name="source:program:eleSourceProgram:edit"><spring:message code="firmware.info"/></shiro:lacksPermission>
			</a>
		</li>
	</ul><br/>
	<form:form id="inputForm" modelAttribute="eleSourceProgram" action="${ctx}/source/program/eleSourceProgram/save" method="post" class="form-horizontal">
		<form:hidden path="id"/>
		<sys:message content="${message}"/>		
		<c:if test="${language == 'zh'}">
		<div class="control-group">
			<label class="control-label"><spring:message code="common.app.type"/>：</label>
			<div class="controls">
				<form:select path="type" >
					<form:options items="${fns:getDictList('programtype')}"   itemLabel="label" itemValue="value" htmlEscape="false" class="input-small" />
				</form:select>
				<span class="help-inline"><font color="red">*</font></span>
			</div>
		</div>
		</c:if>
		<c:if test="${language == 'en'}">
		<div class="control-group" >
			<label class="control-label"><spring:message code="common.app.type"/>：</label>
			<div class="controls">
				<form:select path="type" >
					<form:options items="${fns:getDictList('programtype')}"  itemLabel="enlabel" itemValue="value" htmlEscape="false" class="input-small"/>
				</form:select>
				<span class="help-inline"><font color="red">*</font></span>
			</div>
		</div>
		</c:if>
        <div class="control-group">
            <label class="control-label"><spring:message code="common.versionname"/>：</label>
            <div class="controls">
                <form:input path="name" htmlEscape="false" maxlength="255" class="input-xlarge required"/>
                <span class="help-inline"><font color="red">*</font></span>
            </div>
        </div>
		<div class="control-group">
			<label class="control-label"><spring:message code="common.version"/>：</label>
			<div class="controls">
				<form:input path="version" htmlEscape="false" maxlength="255" class="input-small <%--digits--%> required"/>
				<span class="help-inline"><font color="red">*</font></span>
			</div>
		</div>
		<div class="control-group">
			<label class="control-label"><spring:message code="common.uploadprogram"/>：</label>
			<div class="controls" id="pg1">
				<form:hidden id="path1" path="path1" htmlEscape="false" maxlength="255" class="input-xlarge"/>
				<sys:ckfinder input="path1" type="program1" uploadPath="/source/program/eleSourceProgram" selectMultiple="false" langCode="${langCode}"/>
				<span class="help-inline"><font color="red">*</font> </span>
			</div>
			<div class="controls" id="pg2" style="display: none">
				<form:hidden id="path2" path="path2" htmlEscape="false" maxlength="255" class="input-xlarge"/>
				<sys:ckfinder input="path2" type="program2" uploadPath="/source/program/eleSourceProgram" selectMultiple="false" langCode="${langCode}"/>
				<span class="help-inline"><font color="red">*</font> </span>
			</div>
		</div>
		<div class="control-group">
			<label class="control-label">MD5：</label>
			<div class="controls">
				<form:input path="sign" htmlEscape="false" maxlength="255" class="input-xlarge "/>
			</div>
		</div>
		<div class="control-group">
			<label class="control-label"><spring:message code="common.remarks"/>：</label>
			<div class="controls">
				<form:textarea path="remarks" htmlEscape="false" rows="4" maxlength="255" class="input-xxlarge "/>
			</div>
		</div>
		<div class="form-actions">
			<shiro:hasPermission name="source:program:eleSourceProgram:edit"><input id="btnSubmit" class="btn btn-primary" type="submit" value="<spring:message code='common.save'/>"/>&nbsp;</shiro:hasPermission>
			<input id="btnCancel" class="btn" type="button" value="<spring:message code='common.back'/>" onclick="history.go(-1)"/>
		</div>
	</form:form>
</body>
</html>